package yana.tpe.servlets.task2;

import java.io.File;
import java.util.Properties;

public class Controller extends yana.tpe.servlets.task1.Controller {

    @Override
    protected File getFile(String fileName) {
        try {
            Properties props = new Properties();
            props.load(getServletContext().getResourceAsStream("/WEB-INF/config.properties"));
            String rootFolder = props.getProperty("ROOT_FOLDER", ROOT_FOLDER);
            return new File(rootFolder, fileName);
        } catch (Exception ex) {
            ex.printStackTrace(System.out);
            return super.getFile(fileName);
        }
    }
    
}
